﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="true" Async="true"
    CodeFile="your-details.aspx.cs" Inherits="car_insurance_your_details" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>GluayGluay Mobile</title>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0'
        name='viewport' />
    <link rel="icon" href="../favicon.png" />

    <script src="../js/gluaygluay-mobile.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div class="bg-blur">
            <div class="radius-box">
                <div class="heading-radius" style="height: 60px;">
                    <asp:Label ID="lblYourDeailsTitle" runat="server" Text="<%$ Resources:CarMenu,EnterDetails%>"></asp:Label></div>
                <p class="dotted">
                </p>
                <div class="field-row">
                    <html5:TextInput ID="txtUserName" MaxLength="50" runat="server" CssClass="text-fields"
                        Text="<%$Resources:CarMenu,YourName%>"></html5:TextInput>
                    <asp:RequiredFieldValidator ID="rfvUserName" runat="server" CssClass="validationError"
                        ValidationGroup="personal" ErrorMessage="" Text="" ControlToValidate="txtUserName"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revUserName" runat="server" ValidationGroup="personal"
                        ValidationExpression="^[\p{L}\d]*[^#$%^&*():/\.'^<>]*$" CssClass="validationError"
                        ControlToValidate="txtUserName" ErrorMessage=""></asp:RegularExpressionValidator>
                </div>
                <div class="field-row">
                    <html5:EmailInput ID="txtUserEmail" runat="server" MaxLength="80" CssClass="text-fields"
                        Text="<%$Resources:CarInsurance,YourEmail%>"></html5:EmailInput>
                    <asp:RegularExpressionValidator ID="rfvUserEmail" Text="" CssClass="validationError"
                        runat="server" ValidationGroup="personal" ErrorMessage="" ControlToValidate="txtUserEmail"
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"></asp:RegularExpressionValidator>
                    <asp:RequiredFieldValidator ID="revUserEmail" runat="server" Text="" CssClass="validationError"
                        ValidationGroup="personal" ErrorMessage="" ControlToValidate="txtUserEmail" Display="Dynamic"></asp:RequiredFieldValidator>
                </div>
                <div class="field-row">
                    <html5:PhoneInput ID="txtUserMobile" runat="server" CssClass="text-fields" MaxLength="10"
                        Text="<%$Resources:CarMenu,MobileSample%>"></html5:PhoneInput>
                    <asp:RequiredFieldValidator ID="rfvUserMobile" runat="server" CssClass="validationError"
                        ValidationGroup="personal" ErrorMessage="" Text="" ControlToValidate="txtUserMobile"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revUserMobile" runat="server" ValidationGroup="personal"
                        ValidationExpression="0[5-9]\d{8}" ControlToValidate="txtUserMobile" CssClass="validationError"
                        ErrorMessage=""></asp:RegularExpressionValidator>
                </div>
                <div class="chkbox">
                    <div style="padding-top: 10px; padding-bottom:10px; float: left;">
                        <asp:CheckBox ID="chkAggrement" runat="server" onclick="CheckedChanged();" />
                        <asp:Label ID="lblAggrement" runat="server"></asp:Label>
                        <asp:RequiredFieldValidator ID="rfvIsAccept" runat="server" ControlToValidate="txtIsAccept"
                            CssClass="validationError" Display="Dynamic" ErrorMessage="" ValidationGroup="personal"></asp:RequiredFieldValidator>
                        <div style="display:none;">
                            <asp:TextBox ID="txtIsAccept" runat="server"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="field-row">
                    <asp:Button runat="server" ID="btnSubmit" Text="View Results Now" CssClass="action-button"
                        OnClick="btnSubmit_Click" ValidationGroup="personal" OnClientClick="LoadValidationErrorCss();CheckedChanged();" Width="100%" />
                </div>
                <div class="field-row" id="divFBLogin" runat="server">
                    <div style="width:252px; margin:auto; text-align:center;"><asp:Label ID="lblOR" runat="server"></asp:Label></div>
                        <div id="divFacebookSignin" style="padding-top: 5px;">
                        <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="userLogin(); return false;">
                            <asp:Image ID="imgFB" runat="server" AlternateText="" Width="252" Height="35" Style="padding-bottom: 10px;"
                                ImageUrl="" />
                        </asp:LinkButton>
                        <asp:LinkButton ID="lkFacebookLogin" runat="server" CausesValidation="false" OnClick="lkFacebookLogin_Click"
                            Style="display: none;"></asp:LinkButton>
                        <asp:HiddenField ID="hiddenFacebookName" runat="server" />
                        <asp:HiddenField ID="hiddenFacebookEmail" runat="server" />
                        <asp:HiddenField ID="hiddenFacebookID" runat="server" />
                    </div>                    
                </div>
                <div class="logo-chac">
                    <div style="position: absolute; margin: 25px 0px 0px 140px;">
                        <img src="../images/dog-chac-detail.png" width="123" height="107" alt="" />
                    </div>
                    <img src="<%=GetGlobalResourceObject("CarMenu", "ImgDBDOICVerUrl")%>" width="260"
                        height="146" alt="" />
                </div>
                <div style="display: none;">
                    <asp:HiddenField ID="hdnQuoteId" runat="server" Value="0" />
                    <asp:HiddenField ID="hdnCarId" runat="server" Value="0" />
                    <asp:HiddenField ID="hdnPolicyId" runat="server" Value="0" />
                </div>
                <input id="inputLang" value="" style="display: none;" />
            </div>
        </div>
    </div>
    <script type="text/javascript">
    function RemoveSpace(c) {
            c.value = c.value.split(' ').join('')
        }

        function DefaultName(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value.length == 0 && TextBoxEvent.type == "blur") {
                if (document.getElementById('inputLang').value == 'EN') {
                    TextBoxControl.value = "Your name ...";
                }
                else {
                    TextBoxControl.value = "ชื่อของคุณ  ...";
                }
            }
        }

        function DefaultEmail(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value.length == 0 && TextBoxEvent.type == "blur") {
                if (document.getElementById('inputLang').value == 'EN') {
                    TextBoxControl.value = "Your E-mail address ...";
                }
                else {
                    TextBoxControl.value = "อีเมล์";
                }
            }
        }

        function DefaultPhone(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value.length == 0 && TextBoxEvent.type == "blur") {
                if (document.getElementById('inputLang').value == 'EN') {
                    TextBoxControl.value = "Example: 0893998209";
                }
                else {
                    TextBoxControl.value = "ตัวอย่าง 0893998209";
                }
            }
        }

        function ClearText(TextBoxControl, TextBoxEvent) {
            if (TextBoxControl.value == "Your name ...") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'EN'
            }
            if (TextBoxControl.value == "ชื่อของคุณ  ...") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'TH'
            }
            if (TextBoxControl.value == "Your E-mail address ...") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'EN'
            }

            if (TextBoxControl.value == "อีเมล์") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'TH'
            }
            if (TextBoxControl.value == "Example: 0893998209") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'EN'
            }
            if (TextBoxControl.value == "ตัวอย่าง 0893998209") {
                TextBoxControl.value = "";
                document.getElementById('inputLang').value = 'TH'
            }
        }


        function CheckedChanged() {
            var ctrlTxt = document.getElementById('<%=txtIsAccept.ClientID %>');
            var ctrlAgree = document.getElementById('<%=chkAggrement.ClientID %>');
            var lblAgree = document.getElementById('<%=lblAggrement.ClientID %>');
            ctrlTxt.value = '1';
            lblAgree.style.color = 'black';
            if (ctrlAgree.checked == false) {
                ctrlTxt.value = '';
                lblAgree.style.color = 'red';
            }
        }
    </script>
    
    <script type="text/javascript">
        // Load the SDK Asynchronously
        (function(d) {
            var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
            if (d.getElementById(id)) { return; }
            js = d.createElement('script'); js.id = id; js.async = true;
            js.src = "//connect.facebook.net/en_US/all.js";
            ref.parentNode.insertBefore(js, ref);
        } (document));

        // Init the SDK upon load
        window.fbAsyncInit = function() {
            FB.init({
                appId: '1539438152980941', // App ID
                channelUrl: '//' + window.location.hostname + '/channel', // Path to your Channel File
                status: true, // check login status
                cookie: true, // enable cookies to allow the server to access the session
                xfbml: true  // parse XFBML
            });
        }

        function userLogin() {
            FB.login(function(response) {
                if (response.authResponse) {
                    // user has auth'd your app and is logged into Facebook
                    var access_token = response.authResponse.accessToken;
                    FB.api('/me?fields=id,name,email,first_name,last_name,gender,birthday,relationship_status', function(me) {
                        if (me.name) {
                            //parent.$.fancybox.close();
                            document.getElementById('<%= hiddenFacebookName.ClientID %>').value = me.name;
                            document.getElementById('<%= hiddenFacebookEmail.ClientID %>').value = me.email;
                            document.getElementById('<%= hiddenFacebookID.ClientID %>').value = me.id;

                            var a = document.getElementById("<%= lkFacebookLogin.ClientID %>");
                            var evObj = document.createEvent('MouseEvents');
                            evObj.initMouseEvent('click', true, true, window, 0, 0, 0, 1, 1, false, false, false, false, 0, null);
                            a.dispatchEvent(evObj);
                        }
                    })
                } else {
                    // user has not auth'd your app, or is not logged into Facebook
                }
            }, { scope: 'email,user_birthday,user_relationships' });
        }
    </script>

    
    </form>
</body>
</html>
